package com.wooophone.mpyeah.entity;

import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;

import com.wooophone.common.util.JsonSfUtil;
import com.wooophone.mpyeah.dao.BrandCategoryDao;
import com.wooophone.mpyeah.dao.BrandCategoryFKDao;
import com.wooophone.mpyeah.util.SystemUtil;

/**
 * 
 * 品牌实体对象
 * 
 * @author MingliC
 * 
 */
public class Brand extends BaseEntity {
	/** 分类ID */
	private String cid;
	/** 官网地址 */
	private String tomlive;
	/** 得分 */
	private int score;
	/** 信誉 */
	private int credit;
	/** Logo地址 */
	private String logo;
	/** logo绝对路径 */
	private String logoAbsolutePath;
	/** 是否置顶 */
	private boolean top;
	/** 是否可用 */
	private boolean available;
	/** 评分 */
	private String judge;
	/** 所属分类 */
	private BrandCategory brandCategory;
	/** 在线店铺个数 */
	private int onlineStoreCount;
	/** 实体店铺个数 */
	private int realStoreCount;
	/** 推荐级别 */
	private int level;
	/** 评分字段 */
	private String gradeFields;
	/** 字段列表	 */
	private Object[] gradeFieldArray;
	/** 所属分类  */
	private Set<BrandCategory> categorySet;

	/** 评论总数 */
	private int commentCount;

	/** 顶级店铺 */
	private OnLineStore topOnlineStore;

	/** 顶级推荐的在线店铺 */
	private List<OnLineStore> topLevelRecommendOnLineStore;
	/** 次级推荐的在线店铺 */
	private List<OnLineStore> secondaryLevelRecommendOnLineStore;
	/** 顶推荐的实体店铺 */
	private List<RealStore> topLevelRecommendRealStore;
	/** 次级推荐的实体店铺 */
	private List<RealStore> secondaryLevelRecommendRealStore;
	

	public Object[] getGradeFieldArray() {
		if(gradeFieldArray==null){
			gradeFieldArray = JsonSfUtil.toArray(gradeFields);
		}
		return gradeFieldArray;
	}
	
	/** Logo绝对路径 */
	public String getLogoAbsolutePath() {

		if (logoAbsolutePath == null) {
			if (logo != null) {
				logoAbsolutePath = SystemUtil.imageBasePath + logo;
			} else {
				logoAbsolutePath = null;
			}
		}

		return logoAbsolutePath;
	}

	/** Logo绝对路径 */
	public void setLogoAbsolutePath(String logoAbsolutePath) {
		this.logoAbsolutePath = logoAbsolutePath;
	}

	/** 顶级推荐的在线店铺 */
	public List<OnLineStore> getTopLevelRecommendOnLineStore() {
		return topLevelRecommendOnLineStore;
	}

	/** 顶级推荐的在线店铺 */
	public void setTopLevelRecommendOnLineStore(
			List<OnLineStore> topLevelRecommendOnLineStore) {
		this.topLevelRecommendOnLineStore = topLevelRecommendOnLineStore;
	}

	/** 顶推荐的实体店铺 */
	public List<OnLineStore> getSecondaryLevelRecommendOnLineStore() {
		return secondaryLevelRecommendOnLineStore;
	}

	/** 顶推荐的实体店铺 */
	public void setSecondaryLevelRecommendOnLineStore(
			List<OnLineStore> secondaryLevelRecommendOnLineStore) {
		this.secondaryLevelRecommendOnLineStore = secondaryLevelRecommendOnLineStore;
	}

	/** 次级推荐的实体店铺 */
	public List<RealStore> getTopLevelRecommendRealStore() {
		return topLevelRecommendRealStore;
	}

	/** 次级推荐的实体店铺 */
	public void setTopLevelRecommendRealStore(
			List<RealStore> topLevelRecommendRealStore) {
		this.topLevelRecommendRealStore = topLevelRecommendRealStore;
	}

	/** 次级推荐的实体店铺 */
	public List<RealStore> getSecondaryLevelRecommendRealStore() {
		return secondaryLevelRecommendRealStore;
	}

	/** 次级推荐的实体店铺 */
	public void setSecondaryLevelRecommendRealStore(
			List<RealStore> secondaryLevelRecommendRealStore) {
		this.secondaryLevelRecommendRealStore = secondaryLevelRecommendRealStore;
	}

	/** 分类ID */
	public String getCid() {
		return cid;
	}

	/** 分类ID */
	public void setCid(String cid) {
		this.cid = cid;
	}

	/** 官网地址 */
	public String getTomlive() {
		return tomlive;
	}

	/** 官网地址 */
	public void setTomlive(String tomlive) {
		this.tomlive = tomlive;
	}

	/** 得分 */
	public int getScore() {
		return score;
	}

	/** 得分 */
	public void setScore(int score) {
		this.score = score;
	}

	/** 信誉 */
	public int getCredit() {
		return credit;
	}

	/** 信誉 */
	public void setCredit(int credit) {
		this.credit = credit;
	}

	/** Logo地址 */
	public String getLogo() {
		return logo;
	}

	/** Logo地址 */
	public void setLogo(String logo) {
		this.logo = logo;
	}

	/** 所属分类 */
	public BrandCategory getBrandCategory() {
		return brandCategory;
	}

	/** 所属分类 */
	public void setBrandCategory(BrandCategory brandCategory) {
		this.brandCategory = brandCategory;
	}

	/** 是否置顶 */
	public boolean isTop() {
		return top;
	}

	/** 是否置顶 */
	public void setTop(boolean top) {
		this.top = top;
	}

	/** 是否可用 */
	public boolean isAvailable() {
		return available;
	}

	/** 是否可用 */
	public void setAvailable(boolean available) {
		this.available = available;
	}

	/** 评分 */
	public String getJudge() {
		return judge;
	}

	/** 评分 */
	public void setJudge(String judge) {
		this.judge = judge;
	}

	/** 在线店铺个数 */
	public int getOnlineStoreCount() {
		return onlineStoreCount;
	}

	/** 在线店铺数量 */
	public void setOnlineStoreCount(int onlineStoreCount) {
		this.onlineStoreCount = onlineStoreCount;
	}

	/** 实体店铺数量 */
	public int getRealStoreCount() {
		return realStoreCount;
	}

	/** 实体店铺数量 */
	public void setRealStoreCount(int realStoreCount) {
		this.realStoreCount = realStoreCount;
	}

	/** 推荐级别 */
	public int getLevel() {
		return level;
	}

	/** 推荐级别 */
	public void setLevel(int level) {
		this.level = level;
	}


	public Set<BrandCategory> getCategorySet() {
		return categorySet;
	}

	public void setCategorySet(Set<BrandCategory> categorySet) {
		this.categorySet = categorySet;
	}

	/** 评论总数 */
	public int getCommentCount() {
		return commentCount;
	}

	/** 评论总数 */
	public void setCommentCount(int commentCount) {
		this.commentCount = commentCount;
	}

	/** 顶级推荐的店铺 */
	public OnLineStore getTopOnlineStore() {
		return topOnlineStore;
	}

	/** 顶级推荐的店铺 */
	public void setTopOnlineStore(OnLineStore topOnlineStore) {
		this.topOnlineStore = topOnlineStore;
	}

	/**
	 * 评分字段
	 * @return
	 */
	public String getGradeFields() {
		return gradeFields;
	}

	/**
	 * 评分字段
	 * @param gradeFields
	 */
	public void setGradeFields(String gradeFields) {
		this.gradeFields = gradeFields;
	}

}
